﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BubbleManager : MonoBehaviour
{
    static BubbleManager current;
    [Header("2个泡泡的融合")]
    public Vector3 centerPos2;
    public GameObject bubble2Level;
    private bool isBigger2 = false;

    // Start is called before the first frame update
    void Start()
    {
        if (current != null)
        {
            Destroy(gameObject);
            return;
        }
        current = this;

        DontDestroyOnLoad(gameObject);
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public static void BubbleBlend2(GameObject b1,GameObject b2)
    {
        if (current.isBigger2 == false)
        {
            current.centerPos2 = (b1.transform.position + b2.transform.position) / 2f;
            current.bubble2Level = GameObject.Instantiate(current.bubble2Level, current.centerPos2, current.transform.rotation);
            current.bubble2Level.tag = "LightBubble2";
            current.bubble2Level.transform.localScale = 2 * current.bubble2Level.transform.localScale;
            current.isBigger2 = true;
        }
    }
}
